// -*- C++ -*------------------------------------------------------------------
// $Id: Ligand.cc,v 1.2 2007-10-26 14:55:15 biocomp Exp $
//
//  Class:             Ligand
//
//  Base Class(es):    -
//
//  Derived Class(es): -
//
//  Containing:        -
//
//  Author:            Silvio Tosatto, previous work: Marcus Pruemmer
//
//  Project Name:      Victor
//
//  Date:              02/02, previous work: 06/2000
//
//  Reviewed By:       <Name>
//
//  Description:       --
// 
//  ATTENTION:         This class is *NOT* finished yet.
//                     There are many methods which have only a head
//                     declaration and no code inside.
// ---------------------------------------------------------------------------

//Includes:
#include <Ligand.h>
#include <Debug.h>
#include <IntCoordConverter.h>
#include <limits.h>
#include <float.h>

// Global constants, typedefs, etc. (to avoid):

using namespace Biopool;

// CONSTRUCTORS/DESTRUCTOR:

Ligand::Ligand() : Group(0,0)
{ }

Ligand::Ligand(const Ligand& orig)
{
 this->copy(orig);
}

Ligand::~Ligand()
{
  PRINT_NAME;
}

// PREDICATES:

bool 
Ligand::isMetalCompound()
{
    return ((size() == 1) && (
	(getType() == "1CU" ) ||
	(getType() == "2MO" ) || (getType() == "3CO" ) ||
	(getType() == "4MO" ) || (getType() == "6MO" ) ||

	(getType() == "AG" ) || (getType() == "AL" ) ||
	(getType() == "ALF" ) || (getType() == "ATH" ) ||
	(getType() == "AU" ) || (getType() == "AUC" ) ||

	(getType() == "BA" ) || (getType() == "BR" ) ||

	(getType() == "CA" ) || (getType() == "CD" ) ||
	(getType() == "CD1" ) || (getType() == "CE" ) ||
	(getType() == "CL" ) || (getType() == "CO" ) ||
	(getType() == "CO5" ) || (getType() == "CR" ) ||
	(getType() == "CS" ) || (getType() == "CU" ) ||
	(getType() == "CU1" ) || (getType() == "CUA" ) ||
	(getType() == "CUZ" ) || 

	(getType() == "EU" ) || (getType() == "EU3" ) ||

	(getType() == "F" ) || (getType() == "FE" ) ||
	(getType() == "FE2" ) || (getType() == "GA" ) ||

	(getType() == "HG" ) || (getType() == "HGC" ) ||

	(getType() == "IN" ) || (getType() == "IOD" ) ||
	(getType() == "IR" ) || (getType() == "IUM" ) ||

	(getType() == "K" ) || (getType() == "LA" ) ||
	(getType() == "LCO" ) || (getType() == "LCP" ) ||
	(getType() == "LI" ) || (getType() == "LU" ) ||

	(getType() == "MG" ) || (getType() == "MN" ) ||
	(getType() == "MN3" ) || (getType() == "MN5" ) ||
	(getType() == "MO1" ) || (getType() == "MO2" ) ||
	(getType() == "MO3" ) || (getType() == "MO4" ) ||
	(getType() == "MO5" ) || (getType() == "MO6" ) ||
	(getType() == "MOO" ) || (getType() == "MOS" ) ||
	(getType() == "MW1" ) || (getType() == "MW2" ) ||
	(getType() == "NA" ) || (getType() == "NA5" ) ||
	(getType() == "NA6" ) || (getType() == "NAW" ) ||
	(getType() == "NCO" ) || (getType() == "ND4" ) ||
	(getType() == "NI" ) || (getType() == "NI1" ) ||
	(getType() == "NI2" ) || (getType() == "O4M" ) ||

	(getType() == "OC1" ) || (getType() == "OC2" ) ||
	(getType() == "OC3" ) || (getType() == "OC4" ) ||
	(getType() == "OC5" ) || (getType() == "OC6" ) ||
	(getType() == "OC7" ) || (getType() == "OCL" ) ||
	(getType() == "OCM" ) || (getType() == "OCN" ) ||
	(getType() == "OCO" ) || (getType() == "OF1" ) ||
	(getType() == "OF3" ) || (getType() == "OS" ) ||

	(getType() == "PB" ) || (getType() == "PBM" ) ||
	(getType() == "PT" ) || (getType() == "PTN" ) ||

	(getType() == "RB" ) || (getType() == "SB" ) ||
	(getType() == "SE4" ) || (getType() == "SM" ) ||
	(getType() == "SO3" ) || (getType() == "SO4" ) ||
	(getType() == "SR" ) || (getType() == "SUL" ) ||

	(getType() == "TB" ) || (getType() == "TCN" ) ||
	(getType() == "TL" ) || (getType() == "VO4" ) ||
	(getType() == "WO4" ) || (getType() == "Y1" ) ||
	(getType() == "YB" ) || (getType() == "YT3" ) ||

	(getType() == "ZN" ) || (getType() == "ZN1" ) ||
	(getType() == "ZN2" ) || (getType() == "ZN3" ) ||
	(getType() == "ZNO" ) || (getType() == "1CU" ) 

	) ? true : false );
}

bool 
Ligand::isCommonMetal()
{
    return ((size() == 1) && (
	(getType() == "1CU" ) || (getType() == "3CO" ) ||

	(getType() == "AG" ) || (getType() == "AL" ) ||
	(getType() == "AU" ) || 

	(getType() == "CA" ) || (getType() == "CD" ) ||
	(getType() == "CD1" ) || (getType() == "CO" ) ||
	(getType() == "CO5" ) || (getType() == "CR" ) ||
	(getType() == "CU" ) ||
	(getType() == "CU1" ) || (getType() == "CUA" ) ||
	(getType() == "CUZ" ) ||

	(getType() == "F" ) || (getType() == "FE" ) ||
	(getType() == "FE2" ) || (getType() == "HG" ) || 

	(getType() == "IOD" ) || (getType() == "K" ) || 
	(getType() == "LI" ) || 

	(getType() == "MG" ) || (getType() == "MN" ) ||
	(getType() == "MN3" ) || (getType() == "MN5" ) ||
	(getType() == "MO1" ) || (getType() == "MO2" ) ||
	(getType() == "MO3" ) || (getType() == "MO4" ) ||
	(getType() == "MO5" ) || (getType() == "MO6" ) ||
	(getType() == "MW1" ) || (getType() == "MW2" ) ||
	(getType() == "NA" ) || (getType() == "NA5" ) ||
	(getType() == "NA6" ) || (getType() == "NAW" ) ||
	(getType() == "ND4" ) || (getType() == "NI" ) || 
	(getType() == "NI1" ) || (getType() == "NI2" ) ||

	(getType() == "OC1" ) || (getType() == "OC2" ) ||
	(getType() == "OC3" ) || (getType() == "OC4" ) ||
	(getType() == "OC5" ) || (getType() == "OC6" ) ||
	(getType() == "OC7" ) || (getType() == "OCL" ) ||
	(getType() == "OCM" ) || (getType() == "OCN" ) ||
	(getType() == "OCO" ) || (getType() == "OF1" ) ||
	(getType() == "OF3" ) || (getType() == "PB" ) ||
	(getType() == "PT" ) || (getType() == "SB" ) || 
	(getType() == "SE4" ) ||

	(getType() == "ZN" ) || (getType() == "ZN1" ) ||
	(getType() == "ZN2" ) || (getType() == "ZN3" ) ||
	(getType() == "ZNO" ) || (getType() == "1CU" )

	) ? true : false );
}



// MODIFIERS:

void 
Ligand::copy(const Ligand& orig)
{
  PRINT_NAME; 
  Group::copy(orig);
}

// OPERATORS:

Ligand& 
Ligand::operator=(const Ligand& orig)
{
  PRINT_NAME;
  if (&orig != this)
    copy(orig);
  return *this;
}

// HELPERS:

